# 要管理的进程ID  
$PROCESS_ID = 0  
  
# 检查进程是否存在  
$processes = pm2 list | ConvertFrom-Json  
$processExists = $processes | Where-Object { $_.id -eq $PROCESS_ID }  
if ($processExists) {  
    Write-Host "进程 $PROCESS_ID 存在，正在停止和删除..."  
    pm2 stop $PROCESS_ID  
    pm2 delete $PROCESS_ID  
    if ($LastExitCode -eq 0) {  
        Write-Host "进程 $PROCESS_ID 已成功停止和删除。"  
    } else {  
        Write-Host "停止和删除进程 $PROCESS_ID 时出错。"  
    }  
}  
  
# 启动新的进程  
Write-Host "正在启动新进程..."  
pm2 start ".\src\signIn\http.js"  
if ($LastExitCode -eq 0) {  
    Write-Host "新进程已成功启动。"  
} else {  
    Write-Host "启动新进程时出错。"  
}